home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 284 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.3 KB

  1. From: James Kanze US/ESC 60/3/141 #40763 <kanze@lts.sel.alcatel.de>
  2. Message-ID: <9602051159.AA19131@lts.sel.alcatel.de>
  3. X-Original-Date: Mon, 5 Feb 96 12:59:40 +0100
  4. Path: in2.uu.net!bounce-back
  5. Date: 06 Feb 96 02:31:20 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Organization: -
  8. In-Reply-To: jbuck@Synopsys.COM's message of 03 Feb 96 06:46:42 GMT
  9. Newsgroups: comp.std.c++
  10. Subject: Re: auto_ptr again
  11. References: <4ebhn5$lgt@bmtlh10.bnr.ca> <4eucnc$hr9@hermes.synopsys.com>
  12. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  13.     iQBFAgUBMRa9ouEDnX0m9pzZAQH4JgF+O8A2iKUTDdaTrmlUhKmd91B7ZkES305P
  14.     MZIrDd+qE8gKd3guaSvmXRLefzw96qdK
  15.     =hL0e
  16.  
  17. In article <4eucnc$hr9@hermes.synopsys.com> jbuck@Synopsys.COM (Joe
  18. Buck) writes:
  19.  
  20. |> "john (j.d.) hickin" <hickin@bnr.ca> writes:
  21. |> >And this, the expectation that constructors of the form X(X&) and
  22. |> >X(const X&) must perform a *copy* operation, is, IMHO, the trouble.
  23.  
  24. |> No, the notion that these constructors perform copy operations (and only
  25. |> copy operations) is deeply wired in to the language, in at least three
  26. |> places: argument passing, return value passing, and optimizing away of
  27. |> copy constructors all assume these constructors mean "copy".
  28.  
  29. |> >The original term was reference constructor, a name which, in my opinion,
  30. |> >carefully stepped around all subtleties of language.
  31.  
  32. |> I have never seen this term used.  Stroustrup said "copy constructor"
  33. |> at a very early stage.
  34.  
  35. |> Anyone who writes a class in which X(X&) or X(const X&) does not have the
  36. |> semantics of a copy operation is doing something wrong (e.g. auto_ptr in
  37. |> the draft standard is broken).
  38.  
  39. I wouldn't go quite that far.  X(X&) is a particular form of copy,
  40. which modifies the copied object.  If it is programmed in such a way
  41. that the number of intermittent copies is meaningless (as is the case
  42. in auto_ptr), then it is perfectly valid.
  43.  
  44. --
  45. James Kanze         Tel.: (+33) 88 14 49 00        email: kanze@gabi-soft.fr
  46. GABI Software, Sarl., 8 rue des Francs-Bourgeois, F-67000 Strasbourg, France
  47. Conseils, itudes et rialisations en logiciel orienti objet --
  48.                 -- A la recherche d'une activiti dans une region francophone
  49. ---
  50. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  51.   Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  52.   is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
  53.